<?php
session_start ();
require_once ("../commun/ouvre_base.php");

$_SESSION ['pathway'] = '..';
$_SESSION ['pathway_js'] = '';
$_SESSION ['pathway_uploads'] = '../../uploads/';
include_once ("../header.php");

if (! isset ( $_SESSION ['id'] )) {
	echo "<table class='principale'><tr><td>Session expired</td></tr>";
	echo "<a href='" . $_SESSION ['pathway'] . "/index.php'>Start</a></table>";
} elseif ($_SESSION ['acces_genetique'] == 0) {
	echo "<table class='principale'><tr><td>Restricted area</td></tr>";
	echo "<a href='" . $_SESSION ['pathway'] . "/start.php'>Start</a></table>";
} else {
	
	$action = $_GET ['action']; // edit ou insert
	if ($action == 'edit') {
		echo "<img src='" . $_SESSION ['pathway'] . "/images/modifier.png' height='20' alt='modifier.png' /> ";
	} else if ($action == 'insert') {
		echo "<img src='" . $_SESSION ['pathway'] . "/images/button_add.png' height='20' alt='button_add.png' /> ";
	}
	echo ucfirst ( $action ) . " kit";
	$table = $_GET ['table']; // edit ou insert
	
	$liste_genes_kitv1 = array (
			'ALS2',
			'AP4B1',
			'AP4E1',
			'AP4M1',
			'AP4S1',
			'ATL1',
			'BSCL2',
			'CYP2U1',
			'CYP7B1',
			'DDHD1',
			'ERLIN2',
			'FA2H',
			'GBA2',
			'GJC2',
			'HSPD1',
			'KIAA0196',
			'KIAA0415',
			'KIF1A',
			'KIF5A',
			'NIPA1',
			'PLP1',
			'PNPLA6',
			'REEP1',
			'RTN2',
			'SACS',
			'SETX',
			'SLC16A2',
			'SLC33A1',
			'SPAST',
			'SPG11',
			'SPG20',
			'SPG21',
			'SPG7',
			'ZFYVE26' 
	);
	$liste_genes_kitv2 = array (
			'ALS2',
			'AMPD2',
			'AP4B1',
			'AP4E1',
			'AP4M1',
			'AP4S1',
			'AP5B1',
			'AP5M1',
			'AP5S1',
			'AP5Z1',
			'ARL6IP1',
			'ARSI',
			'ATL1',
			'B4GALNT1',
			'BICD2',
			'BSCL2',
			'C12orf65',
			'C19orf12',
			'CCDC64',
			'CCER1',
			'CCT5',
			'CPT1C',
			'CYP2U1',
			'CYP7B1',
			'DDHD1',
			'DDHD2',
			'ENTPD1',
			'ERLIN1',
			'ERLIN2',
			'FA2H',
			'FBXO7',
			'FLRT1',
			'GAD1',
			'GBA2',
			'GJA1',
			'GJC2',
			'GRID1',
			'HSPD1',
			'KIAA0196',
			'KIF1A',
			'KIF1C',
			'KIF5A',
			'L1CAM',
			'MAG',
			'MARS',
			'MCM7',
			'MT-ATP6',
			'NIPA1',
			'NT5C2',
			'PGAP1',
			'PLP1',
			'PNPLA6',
			'RAB3GAP2',
			'REEP1',
			'REEP2',
			'RTN2',
			'SACS',
			'SAMHD1',
			'SETX',
			'SLC16A2',
			'SLC33A1',
			'SPAST',
			'SPG11',
			'SPG20',
			'SPG21',
			'SPG7',
			'TECPR2',
			'TFG',
			'USP8',
			'VCP',
			'VPS37A',
			'WDR48',
			'ZFR',
			'ZFYVE26' 
	);
	;
	$liste_genes_kitTSCA = array (
			'AP5Z1',
			'B4GALNT1',
			'CYP2U1',
			'CYP7B1',
			'DDHD1',
			'DDHD2',
			'ERLIN2',
			'FA2H',
			'GBA2',
			'GRID1',
			'KIF1A',
			'PLA2G6',
			'PNPLA6',
			'TECPR2',
			'TFG',
			'ZFYVE26' 
	);
	
	$hash_champ_valeur = array ();
	if ($action == 'edit') { // on récupère les données dans la index déjà dans la base
		
		$index = $_GET ['index'];
		
		// ~ ------------------------ en cas de modifs sur les fichiers
		$query_fichiersattaches = "SELECT `fichiersattaches`
		FROM `kit`
		WHERE `index` LIKE " . $_GET ['index'];
		// ~ echo $query_fichiersattaches;
		$resultat_fichiersattaches = mysql_query ( $query_fichiersattaches ) or die ( "impossible de remplir le questionnaire : " . mysql_error () );
		$fichiers_attaches_base = mysql_fetch_array ( $resultat_fichiersattaches );
		
		$fichiersattaches = $fichiers_attaches_base ['fichiersattaches'];
		if (isset ( $_GET ['delete'] )) {
			$fichiersattaches = str_replace ( $_GET ['delete'] . ';', '', $fichiersattaches );
			unlink ( $_SESSION ['pathway_uploads'] . $_GET ['delete'] );
			$query_update_fichiers = "UPDATE `spatax`.`kit` SET `fichiersattaches` = '$fichiersattaches' WHERE `kit`.`index` = " . $_GET ['index'];
			mysql_query ( $query_update_fichiers ) or die ( "impossible d'updater fichiers : " . mysql_error () );
		}
		
		$requete_index = "SELECT * FROM `" . $table . "`
		WHERE `index` LIKE " . $_GET ['index'] . ";";
		// ~ echo $requete_index;
		$result_requete_index = mysql_query ( $requete_index ) or die ( "Impossible de recupérer les entetes : " . mysql_error () );
		
		while ( $ligne = mysql_fetch_assoc ( $result_requete_index ) ) {
			foreach ( $ligne as $champ => $valeur ) {
				$hash_champ_valeur [$champ] = $valeur;
			}
		}
		$code1 = $hash_champ_valeur ['code1'];
		$code2 = $hash_champ_valeur ['code2'];
		$code3 = $hash_champ_valeur ['code3'];
		$code4 = $hash_champ_valeur ['code4'];
		$code5 = $hash_champ_valeur ['code5'];
		$gene = $hash_champ_valeur ['gene'];
		$status = $hash_champ_valeur ['statut'];
		$validation = $hash_champ_valeur ['validation'];
		
		// print_r($hash_champ_valeur);
	} elseif ($action == 'insert') {
		require_once ("../requetes/recupere_max.php");
		
		if (isset ( $_SESSION ['code1'] )) {
			$code1 = $_SESSION ['code1'];
		}
		if (isset ( $_SESSION ['code2'] )) {
			$code2 = $_SESSION ['code2'];
		}
		if (isset ( $_SESSION ['code3'] )) {
			$code3 = $_SESSION ['code3'];
		}
		if (isset ( $_SESSION ['code4'] )) {
			$code4 = $_SESSION ['code4'];
		}
		if (isset ( $_SESSION ['code5'] )) {
			$code5 = $_SESSION ['code5'];
		}
		$status = $_SESSION ['status'];
		$validation = $_SESSION ['validation'];
	} else {
		echo "error";
	}
	
	if (isset ( $_FILES ['fichieraajouter'] ) and $_FILES ['fichieraajouter'] ['error'] == 0) {
		$tabledate = getdate ();
		$id_unique = $tabledate ['seconds'] . $tabledate ['minutes'] . $tabledate ['hours'] . $tabledate ['mday'] . $tabledate ['mon'] . $tabledate ['year'];
		
		move_uploaded_file ( $_FILES ['fichieraajouter'] ['tmp_name'], $_SESSION ['pathway_uploads'] . $id_unique . '_' . basename ( $_FILES ['fichieraajouter'] ['name'] ) );
		chmod ( $_SESSION ['pathway_uploads'] . $id_unique . '_' . basename ( $_FILES ['fichieraajouter'] ['name'] ), 0777 );
		$hash_champ_valeur ['fichiersattaches'] .= $id_unique . '_' . basename ( $_FILES ['fichieraajouter'] ['name'] ) . ";";
	}
	
	// ~ print_r($hash_champ_valeur);
	
	?>

<!-- kit ########################### -->

<?php
	
	$disabled_tous = '';
	if ($_SESSION ['acces_genetique'] >= 2) {
		?><form
	action="./requetes/remplissage_kit.php&#63;action=<?php echo $action; ?>&amp;index=<?php echo $index; ?>&amp;table=kit"
	method='post' enctype='multipart/form-data'><?php
	} else {
		$disabled_tous = 'disabled';
	}
	$disabled_droits_supremes = '';
	if ($_SESSION ['acces_genetique'] < 3) {
		$disabled_droits_supremes = 'disabled';
	}
	?>
	
	<table class='principale'>
		<tr>
			<td><i>User : </i><input <?php echo $disabled_tous.' ';?> type="text"
				name="user" readonly="readonly" style="width: 200px; border: none;"
				value="<?php
	if (isset ( $hash_champ_valeur ['user'] ) and $hash_champ_valeur ['user'] != '') { // on considère que le champ est egal à '' uniquement lors de la création de la fiche qu'il n'est jamais vide après
		echo strtoupper ( $hash_champ_valeur ['user'] );
	} else {
		$hash_champ_valeur ['user'] = $_SESSION ['id'];
		echo strtoupper ( $hash_champ_valeur ['user'] );
	}
	?>" /></td>
			<td><i>Last modifier : </i><input <?php echo $disabled_tous;?>
				type="text" name="last_modifier" readonly="readonly"
				style="width: 200px; border: none;"
				value="<?php
	if (isset ( $hash_champ_valeur ['last_modifier'] ) and $hash_champ_valeur ['last_modifier'] != '') {
		echo strtoupper ( $hash_champ_valeur ['last_modifier'] );
	} else {
		echo strtoupper ( $hash_champ_valeur ['user'] );
	}
	?>" /></td>
		</tr>
	</table>



	<table class='principale'>
		<tr>
			<td>Code ID Family : <br /> <input <?php echo $disabled_tous.' ';?>
				type="text" maxlength="3" size="3" name="code1" id="code1"
				value='<?php if(isset($code1)){echo strtoupper($code1);} ?>' />- <input
				<?php echo $disabled_tous.' ';?> type="text" maxlength="3" size="3"
				name="code2" id="code2"
				value='<?php if(isset($code2)){echo strtoupper($code2);} ?>' />- <input
				<?php echo $disabled_tous.' ';?> type="text" maxlength="3" size="3"
				name="code3" id="code3"
				value='<?php if(isset($code3)){echo strtoupper($code3);} ?>' />- <input
				<?php echo $disabled_tous.' ';?> type="text" maxlength="4" size="4"
				name="code4" id="code4"
				value='<?php if(isset($code4)){echo strtoupper($code4);} ?>' />
			</td>

			<td>Individual&#40;s&#41; : <br /> <input
				<?php echo $disabled_tous.' ';?> type='text' style='width: 100px;'
				id='code5' name="code5"
				value='<?php if(isset($code5)){echo $code5;} ?>' />&#42;&#40;&#34;&#59;&#34;
				as separator&#41;
			</td>
			<td align='center'>and/or :</td>
			<td>External code : <br /> <input <?php echo $disabled_tous.' ';?>
				type='text' style='width: 100px;' id='codeexterne'
				value='<?php if(isset($hash_champ_valeur['codeexterne'])){echo $hash_champ_valeur['codeexterne'];} ?>' />&#42;
			</td>
			<td>Genethon code : <br /> <input <?php echo $disabled_tous.' ';?>
				type='text' style='width: 100px;' id='codegenethon'
				value='<?php if(isset($hash_champ_valeur['codegenethon'])){echo $hash_champ_valeur['codegenethon'];} ?>' /></td>
		</tr>

	<?php
	$liste_centers = Array ();
	$requete_liste_centers = "SELECT DISTINCT `center` FROM `centres` ORDER BY `center`;";
	$resultat_liste_centers = mysql_query ( $requete_liste_centers ) or die ( "Error liste centers : " . mysql_error () );
	while ( $ligne = mysql_fetch_array ( $resultat_liste_centers ) ) {
		array_push ( $liste_centers, $ligne [0] );
	}
	?>
	<tr onMouseOver="this.classid='highlight'"
			onMouseOut="this.classid='normal'">
			<td>Center : <br /> <select name="center" id="center">
					<option></option>
		<?php
	foreach ( $liste_centers as $center ) {
		echo "<option value='$center'";
		if (isset ( $hash_champ_valeur ['center'] ) and $hash_champ_valeur ['center'] == $center) {
			echo "selected='selected'";
			$requete_vide = 'non';
		}
		echo " > $center</option>";
	}
	?>

		
		</select></td>

			<td>Neurologist : <br /> <input <?php echo $disabled_tous.' ';?>
				type='text' style='width: 100px;' id='neurologist'
				value='<?php if(isset($hash_champ_valeur['neurologist'])){echo $hash_champ_valeur['neurologist'];} ?>' /></td>
		</tr>
	</table>

	<table class='principale'>

		<tr>
			<td>Date :</td>
			<td><input <?php echo $disabled_tous.' ';?> type='text'
				style='width: 100px;' id='date'
				value='<?php if(isset($hash_champ_valeur['date']) and $hash_champ_valeur['date'] != ''){ echo $hash_champ_valeur['date']; }else{ echo $_SESSION['date'];} ?>' />&#42;(yyyy-mm-dd)</td>
			<td></td>
			<td></td>
			<td style="border: 1px solid #BCD0D6; padding: 10px;">Status : <select
				<?php echo $disabled_tous.' ';?> size='1' id='statut'>
					<option></option>
					<option value='ongoing'
						<?php if(isset($hash_champ_valeur['statut']) and $hash_champ_valeur['statut'] == 'ongoing'){ echo "selected='selected'"; } ?>>
						ongoing</option>
					<option value='done'
						<?php if(isset($hash_champ_valeur['statut']) and $hash_champ_valeur['statut'] == 'done'){ echo "selected='selected'"; } ?>>
						done</option>
					<option value='to do'
						<?php if(isset($hash_champ_valeur['statut']) and $hash_champ_valeur['statut'] == 'to do'){ echo "selected='selected'"; } ?>>
						to do</option>
			</select></td>
		</tr>

		<tr>
			<td>Kit :</td>
			<td style="border: 0; padding: 0px;">
				<table>
					<tr>

						<td style="border: 0; padding: 0px;"><select
							<?php echo $disabled_tous.' ';?> size='1' id='kit'>
								<option value='null' onclick="toggleDisplayKit('null')"
									<?php if(isset($hash_champ_valeur['kit']) and $hash_champ_valeur['kit'] == 'null'){ echo "selected='selected'"; } ?>></option>
								<option value='Kit capture Roche HSP V1 - 34 gene'
									onclick="toggleDisplayKit('divkitv1')"
									<?php if(isset($hash_champ_valeur['kit']) and $hash_champ_valeur['kit'] == 'Kit capture Roche HSP V1 - 34 gene'){ echo "selected='selected'"; } ?>>
									Kit capture Roche HSP V1 - 34 genes</option>
								<option value='Kit capture Roche HSP V2 - 74 genes'
									onclick="toggleDisplayKit('divkitv2')"
									<?php if(isset($hash_champ_valeur['kit']) and $hash_champ_valeur['kit'] == 'Kit capture Roche HSP V2 - 74 genes'){ echo "selected='selected'"; } ?>>
									Kit capture Roche HSP V2 - 74 genes</option>
								<option
									value='Kit TSCA TruSeq Cutom Amplicon Illumina ARHSP Lipid - 16 genes'
									onclick="toggleDisplayKit('divkitTSCA')"
									<?php if(isset($hash_champ_valeur['kit']) and $hash_champ_valeur['kit'] == 'Kit TSCA TruSeq Cutom Amplicon Illumina ARHSP Lipid - 16 genes'){ echo "selected='selected'"; } ?>>
									Kit TSCA TruSeq Cutom Amplicon Illumina ARHSP Lipid - 16 genes
								</option>
						</select></td>

						<td>
							<div class="infobulle">
								<img
									src='<?php echo $_SESSION['pathway']; ?>/images/point_dinterrogation.png'
									height='25' /> <span>
									<h1>Kit V1</h1>ALS2,AP4B1,AP4E1,AP4M1,AP4S1,ATL1,BSCL2,CYP2U1,<br />
									CYP7B1,DDHD1,ERLIN2,FA2H,GBA2,GJC2,HSPD1,KIAA0196,<br />
									KIAA0415,KIF1A,KIF5A,NIPA1,PLP1,PNPLA6,REEP1,RTN2,<br />
									SACS,SETX,SLC16A2,SLC33A1,SPAST,SPG11,SPG20,SPG21,<br />
									SPG7,ZFYVE26
									<h4>Kit V2</h4>RAB3GAP2,KIAA0196,FBXO7,DDHD1,CCT5,C12orf65,<br />
									B4GALNT1,RTN2,DDHD2,C19orf12,BSCL2,CYP2U1,SPAST,<br />
									REEP2,SACS,ZFR,AP5S1,VPS37A,L1CAM,AP5Z1,TFG,REEP1,<br />
									AP5B1,GJA1,SPG20,SPG7,KIF1A,MARS,BICD2,NIPA1,ERLIN1,<br />
									AP5M1,CCDC64,KIF1C,SPG11,GBA2,ARL6IP1,MCM7,SETX,<br />
									SLC33A1,AP4M1,NT5C2,KIF5A,ARSI,AMPD2,FA2H,AP4S1,<br />
									CCER1,WDR48,AP4B1,MAG,ENTPD1,GAD1,FLRT1,USP8,<br />
									AP4E1,PNPLA6,CPT1C,GJC2,PGAP1,HSPD1,ALS2,ATL1,<br />
									TECPR2,VCP,SLC16A2,CYP7B1,ERLIN2,PLP1,SPG21,<br />
									ZFYVE26,GRID1,MT-ATP6,SAMHD1
									<h4>Kit TSCA</h4>GRID1,CYP2U1,AP5Z1,GBA2,ZFYVE26,PLA2G6,B4GALNT1,<br />
									FA2H,TECPR2,CYP7B1,TFG,KIF1A,ERLIN2,DDHD2,DDHD1,<br /> PNPLA6<br />
								</span>
							</div>
						</td>




					</tr>
				</table>
		
		</tr>

		<tr>
			<td>Technique :</td>
			<td><select size='1' id='techniquekit'>
					<option></option>
					<option value='exome'
						onclick="setReadOnly(this.value, get_radio_value())"
						<?php if(isset($hash_champ_valeur['techniquekit']) and $hash_champ_valeur['techniquekit'] == 'exome'){ echo "selected='selected'"; } ?>>
						exome</option>
					<option value='target'
						onclick="setReadOnly(this.value, get_radio_value())"
						<?php if(isset($hash_champ_valeur['techniquekit']) and $hash_champ_valeur['techniquekit'] == 'target'){ echo "selected='selected'"; } ?>>
						target</option>
			</select></td>
		</tr>


		<tr>
			<td></td>
			<td colspan=5>
				<!-- ########################### kit 1 ########################### -->

				<div id='divkitv1' style='display: none;'>
					<table class='secondaire'>
						<tr>
							<td>Gene</td>
							<td>Mode</td>
							<td>Mutations</td>
							<td>Alleles</td>
							<td>Transcript (nomenclature)
							
							<td>Sanger validation</td>
							<td>Cosegregation</td>
							<td>Comments</td>
						</tr>
	<?php
	foreach ( $liste_genes_kitv1 as $gene ) {
		?><tr>
							<td><?php echo $gene; ?></td>

							<td><select size='1' id='modekit'>
									<option></option>
									<option value='dominant'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										dominant</option>
									<option value='recessive'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										recessive</option>
									<option value='X-linked'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										X-linked</option>
									<option value='pseudodominant'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										pseudodominant</option>
									<option value='sporadique'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										sporadique</option>
							</select></td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='mutation1'
								value='<?php if(isset($hash_champ_valeur['mutation1'])){echo $hash_champ_valeur['mutation1'];} ?>' />
								<br /> <input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='mutation2'
								value='<?php if(isset($hash_champ_valeur['mutation2'])){echo $hash_champ_valeur['mutation2'];} ?>' />
							</td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='allele1'
								value='<?php if(isset($hash_champ_valeur['allele1'])){echo $hash_champ_valeur['allele1'];} ?>' />
								<br /> <input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='allele2'
								value='<?php if(isset($hash_champ_valeur['allele2'])){echo $hash_champ_valeur['allele2'];} ?>' />
							</td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='transcript'
								value='<?php if(isset($hash_champ_valeur['transcript'])){echo $hash_champ_valeur['transcript'];} ?>' /></td>
							<td><input <?php echo $disabled_tous.' ';?> type='checkbox'
								id='validationsanger' value='yes' /></td>
							<td><input <?php echo $disabled_tous.' ';?> type='checkbox'
								id='cosegregation' value='yes' /></td>

							<td><textarea <?php echo $disabled_tous.' ';?> id='comment'
									name='comment'><?php if(isset($hash_champ_valeur['comment'])){echo $hash_champ_valeur['comment'];} ?></textarea></td>
	<?php
	}
	?>
	</tr>
					</table>
				</div> <!-- ########################### kit 2 ########################### -->
				<div id='divkitv2' style='display: none;'>
					<table class='secondaire'>
						<tr>
							<td>Gene</td>
							<td>Mode</td>
							<td>Mutations</td>
							<td>Alleles</td>
							<td>Transcript (nomenclature)
							
							<td>Sanger validation</td>
							<td>Cosegregation</td>
							<td>Comments</td>
						</tr>
	<?php
	foreach ( $liste_genes_kitv2 as $gene ) {
		?><tr>
							<td><?php echo $gene; ?></td>

							<td><select size='1' id='modekit'>
									<option></option>
									<option value='dominant'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										dominant</option>
									<option value='recessive'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										recessive</option>
									<option value='X-linked'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										X-linked</option>
									<option value='pseudodominant'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										pseudodominant</option>
									<option value='sporadique'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										sporadique</option>
							</select></td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='mutation1'
								value='<?php if(isset($hash_champ_valeur['mutation1'])){echo $hash_champ_valeur['mutation1'];} ?>' />
								<br /> <input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='mutation2'
								value='<?php if(isset($hash_champ_valeur['mutation2'])){echo $hash_champ_valeur['mutation2'];} ?>' />
							</td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='allele1'
								value='<?php if(isset($hash_champ_valeur['allele1'])){echo $hash_champ_valeur['allele1'];} ?>' />
								<br /> <input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='allele2'
								value='<?php if(isset($hash_champ_valeur['allele2'])){echo $hash_champ_valeur['allele2'];} ?>' />
							</td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='transcript'
								value='<?php if(isset($hash_champ_valeur['transcript'])){echo $hash_champ_valeur['transcript'];} ?>' /></td>
							<td><input <?php echo $disabled_tous.' ';?> type='checkbox'
								id='validationsanger' value='yes' /></td>
							<td><input <?php echo $disabled_tous.' ';?> type='checkbox'
								id='cosegregation' value='yes' /></td>
							<td><textarea <?php echo $disabled_tous.' ';?> id='comment'
									name='comment'><?php if(isset($hash_champ_valeur['comment'])){echo $hash_champ_valeur['comment'];} ?></textarea></td>
		
	<?php
	}
	?>
	</tr>
					</table>
				</div> <!-- ---------------- kit TSCA ----------------- -->

				<div id='divkitTSCA' style='display: none;'>
					<table class='secondaire'>
						<tr>
							<td>Gene</td>
							<td>Mode</td>
							<td>Mutations</td>
							<td>Alleles</td>
							<td>Transcript (nomenclature)
							
							<td>Sanger validation</td>
							<td>Cosegregation</td>
							<td>Comments</td>
						</tr>
	
	<?php
	
	foreach ( $liste_genes_kitTSCA as $gene ) {
		?><tr>
							<td><?php echo $gene; ?></td>
							<td><select size='1' id='modekit'>
									<option></option>
									<option value='dominant'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										dominant</option>
									<option value='recessive'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										recessive</option>
									<option value='X-linked'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										X-linked</option>
									<option value='pseudodominant'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										pseudodominant</option>
									<option value='sporadique'
										onclick="setReadOnly(this.value, get_radio_value())"
										<?php if(isset($hash_champ_valeur['modekit']) and $hash_champ_valeur['modekit'] == 'sequencing'){ echo "selected='selected'"; } ?>>
										sporadique</option>
							</select></td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='mutation1'
								value='<?php if(isset($hash_champ_valeur['mutation1'])){echo $hash_champ_valeur['mutation1'];} ?>' />
								<br /> <input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='mutation2'
								value='<?php if(isset($hash_champ_valeur['mutation2'])){echo $hash_champ_valeur['mutation2'];} ?>' />
							</td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='allele1'
								value='<?php if(isset($hash_champ_valeur['allele1'])){echo $hash_champ_valeur['allele1'];} ?>' />
								<br /> <input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='allele2'
								value='<?php if(isset($hash_champ_valeur['allele2'])){echo $hash_champ_valeur['allele2'];} ?>' />
							</td>
							<td><input <?php echo $disabled_tous.' ';?> type='text'
								style='width: 100px;' id='transcript'
								value='<?php if(isset($hash_champ_valeur['transcript'])){echo $hash_champ_valeur['transcript'];} ?>' /></td>
							<td><input <?php echo $disabled_tous.' ';?> type='checkbox'
								id='validationsanger' value='yes' /></td>
							<td><input <?php echo $disabled_tous.' ';?> type='checkbox'
								id='cosegregation' value='yes' /></td>
							<td><textarea <?php echo $disabled_tous.' ';?> id='comment'
									name='comment'><?php if(isset($hash_champ_valeur['comment'])){echo $hash_champ_valeur['comment'];} ?></textarea></td>
		
		
	<?php
	}
	
	?>
	</tr>
					</table>
				</div>
		
		
		<tr>
			<td>OR Upload kit file : (help)</td>
			<td><input <?php echo $disabled_tous.' ';?> type='file'
				id='fichieraajouter' size="10" value='' /><input
				<?php echo $disabled_tous.' ';?> type='submit' id='submitprinc'
				value='upload' /><i> (max 10)</i></td>
		</tr>














		</td>
		</tr>

		<tr>
			<td>Variants of Unknown Significance (VUS) :</td>
			<td><textarea <?php echo $disabled_tous.' ';?> id='vus' cols='20'
					rows='10'><?php if(isset($hash_champ_valeur['vus'])){echo $hash_champ_valeur['vus'];} ?></textarea></td>
		
		
		<tr>
			<td>Comments :</td>
			<td><textarea <?php echo $disabled_tous.' ';?> id='commentaireskit'
					cols='20' rows='1'><?php if(isset($hash_champ_valeur['commentaireskit'])){echo $hash_champ_valeur['commentaireskit'];} ?></textarea></td>
		</tr>

		<tr>
			<td>Attached file(s) :</td>
			<td>
	<?php
	
	if (isset ( $hash_champ_valeur ['fichiersattaches'] )) {
		$table_fichiers = explode ( ';', $hash_champ_valeur ['fichiersattaches'] );
		foreach ( $table_fichiers as $fichier_attache ) {
			if ($fichier_attache != '') {
				echo "<img src='" . $_SESSION ['pathway'] . "/images/poubelle.png' height='15' onclick=\"confirmer_suppression_fichier('" . $code1 . '-' . $code2 . '-' . $code3 . '-' . $code4 . '-' . $code5 . "','$index','$table','$fichier_attache')\" /> <a target=_blank href='" . $_SESSION ['pathway_uploads'] . "/$fichier_attache'>$fichier_attache</a><br />"; // on affiche juste la liste des fichiers déjà présents dans la base
			}
		}
	}
	
	?></td>

			<td><input <?php echo $disabled_tous.' ';?> type='hidden'
				id='fichiersattaches' id='fichiersattaches'
				value='<?php if(isset($hash_champ_valeur['fichiersattaches'])){ echo $hash_champ_valeur['fichiersattaches']; } ?>' />
			
			<td><input <?php echo $disabled_tous.' ';?> type='file'
				id='fichieraajouter' size="10" value='' /><input
				<?php echo $disabled_tous.' ';?> type='submit' id='submitprinc'
				value='upload' /><i> (max 10)</i></td>
		</tr>

	</table>

	<table class='principale'>
		<tr>
			<td><h3>Diagnosis :</h3></td>
			<td><label><input <?php echo $disabled_tous.' ';?> type='radio'
					name='diagnostickit' value='mutated'
					<?php if(isset($hash_champ_valeur['diagnostickit']) and $hash_champ_valeur['diagnostickit'] == 'mutated'){ echo "checked='checked'"; } ?> />
					mutated </label><br /> <label><input
					<?php echo $disabled_tous.' ';?> type='radio' name='diagnostickit'
					value='not mutated'
					<?php if(isset($hash_champ_valeur['diagnostickit']) and $hash_champ_valeur['diagnostickit'] == 'not mutated'){ echo "checked='checked'"; } ?> />
					not mutated </label><br /> <label><input
					<?php echo $disabled_tous.' ';?> type='radio' name='diagnostickit'
					value='healthy carrier'
					<?php if(isset($hash_champ_valeur['diagnostickit']) and $hash_champ_valeur['diagnostickit'] == 'healthy carrier'){ echo "checked='checked'"; } ?> />
					healthy carrier </label></td>
		</tr>

		<tr>
			<td><h3>Validation :</h3></td>

			<td>

	<?php
	echo "<label><input " . $disabled_tous . ' ' . $disabled_droits_supremes . ' ' . "type='radio' name='validation' value='yes' ";
	if (isset ( $validation ) and $validation == 'yes') {
		echo "checked='checked'";
	}
	echo "/> yes </label><br />";
	echo "<label><input " . $disabled_tous . ' ' . $disabled_droits_supremes . ' ' . "type='radio' name='validation' value='no' ";
	if (isset ( $validation ) and $validation == 'no' or isset ( $validation ) and $validation == '') {
		echo "checked='checked'";
	}
	echo "/> no </label>";
	?>

	</td>
		</tr>
		<tr>
			<td><h3>To do :</h3></td>
			<td><textarea <?php echo $disabled_tous.' ';?> id='afaire' cols='15'
					rows='3'><?php if(isset($hash_champ_valeur['afaire'])){echo $hash_champ_valeur['afaire'];} ?></textarea></td>
		</tr>

		<tr>
			<td><h3>Comments :</h3></td>
			<td><textarea <?php echo $disabled_tous.' ';?>
					id='commentairesconclusion' cols='15' rows='3'><?php if(isset($hash_champ_valeur['commentairesconclusion'])){echo $hash_champ_valeur['commentairesconclusion'];} ?></textarea></td>
		</tr>
		<tr>
			<td><input <?php echo $disabled_tous.' ';?> type='submit'
				id='submitprinc' value='Ok' /></td>
		</tr>
	</table>
</form>

<?php
}
include ("../footer.php");
?>
